#include <bits/stdc++.h>
using namespace std;

struct TreeNode {
    int val;
    TreeNode *left;
    TreeNode *right;
    TreeNode() : val(0), left(nullptr), right(nullptr) {}
    TreeNode(int x) : val(x), left(nullptr), right(nullptr) {}
    TreeNode(int x, TreeNode *left, TreeNode *right) : val(x), left(left), right(right) {}
};

class Solution {
public:
	int sumOfLeftLeaves(TreeNode* root) {
		if(root == NULL){
			return 0;
		}
		if(root->left == NULL && root->right == NULL){
			return 0; 
		}
		// 两种情况，要么从后面递归上来的leftValue有，没有的话就是说明当前节点就是左叶子节点的父节点
		int leftValue = sumOfLeftLeaves(root->left);
		
		if(root->left!=NULL && root->left->left==NULL&& root->left->right==NULL){
			leftValue = root->left->val;
		}
		int rightValue = sumOfLeftLeaves(root->right);
		return leftValue + rightValue;
	}
};


int main(){
	
	return 0;
}
